FROM alpine

RUN apk update &&\
    # apk upgrade --no-progress &&\ # desnecessario
    apk add --no-progress nodejs &&\
    apk add --no-progress npm

# admin
RUN adduser -D -h /home/app -s /bin/false app app
ENV HOME=/home/app

# admin
USER root
WORKDIR $HOME
RUN chown -R app:app $HOME/

# API : config
COPY package.json $HOME
# RUN npm shrinkwrap --silent --progress=false
COPY package-lock.json $HOME

# files of server
COPY . $HOME

# API : npm install
RUN npm install --silent --progress=false

# API : Cunstom
RUN npm install --global --progress=false --silent nodemon &&\
    npm install --global --progress=false --silent babel-cli &&\
    npm install --global --progress=false --silent babel-preset-env

USER app
# FINIshin
CMD ["npm", "run", "start"]
